package com.spzx.product.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.product.api.RemoteBrandService;
import com.spzx.product.api.domain.Brand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;

import java.util.List;

public class RemoteBrandFallbackFactory implements FallbackFactory<RemoteBrandService> {
    private  static  final Logger log= LoggerFactory.getLogger(RemoteBrandFallbackFactory.class);
    @Override
    public RemoteBrandService create(Throwable cause) {
        log.error("查询所有品牌服务失败"+cause.getMessage());
        return new RemoteBrandService() {
            @Override
            public R<List<Brand>> getAllBrand(String source) {
                return R.fail("获取所有品牌服务失败"+cause.getMessage());
            }
        };
    }
}
